package com.lost.octopus.es.helper.entity.wrapper;

import com.lost.octopus.es.helper.entity.model.FieldConfig;

import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.springframework.stereotype.Component;

/**
 * 单个条件查询
 * <br/>
 * 注解：{@code @EsSearch}
 * <br/>
 * 示例：{@code "你好"}
 * <br/>
 * 效果：{@code {"must":[{"term":{?:{"value":"你好"}}}]} }
 * @author zhangbh
 **/
@Component
public class EsQueryWrapper extends AbstractQueryWrapper {
    @Override
    public QueryBuilder addWrapper(BoolQueryBuilder builder, FieldConfig field) {
        QueryBuilder query = useBuilder(field);
        useMode(builder, query, getMode(field));
        return query;
    }
}
